package helper;

import modelo.Mineral;

import org.jdesktop.beansbinding.Converter;

public class MineralStringConverter extends Converter<Mineral, String> {

	@Override
	public String convertForward(Mineral mineral) {
		return mineral.toString();
	}

	@Override
	public Mineral convertReverse(String str) {
		if (str.equals("Hierro"))
			return Mineral.Hierro;
		else if (str.equals("Zinc"))
			return Mineral.Zinc;
		else
			throw new RuntimeException(String.format("No type conversion found for: %s", str));
	}

}
